//
//  ProvincesGenerator.m
//  Utils
//
//  Created by enghou on 2018/4/21.
//  Copyright © 2018年 xyxorigation. All rights reserved.
//

#import "ProvincesGenerator.h"

@implementation ProvincesGenerator
+(NSArray <Province *>*)generatProvinces{
    NSString *path = [[NSBundle mainBundle]pathForResource:@"province" ofType:@"json"];
    NSData *jsonData = [NSData dataWithContentsOfFile:path];
    NSError *error = nil;
    NSArray *provinces = [NSJSONSerialization JSONObjectWithData:jsonData options:NSJSONReadingMutableLeaves error:&error];
    NSMutableArray *p = [NSMutableArray array];
    for (NSDictionary *element in provinces) {
        Province *province = [[Province alloc]initWithSource:element];
        [p addObject:province];
        
    }
    return p;
    return nil;
}
@end
